package com.mys2sh.service.impl;

import com.mys2sh.dao.UserDao;
import com.mys2sh.model.User;
import com.mys2sh.service.UserService;

public class UserServiceImpl implements UserService {

	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public boolean checkValidUser(String userName, String passWord) {
		User user = getUserInfoByUserName(userName);
		if (user != null && passWord.equals(user.getPassWord())) {
			return true;
		}
		return false;
	}

	public User getUserInfoByUid(int uid) {
		return userDao.getUserInfoByUid(uid);
	}
	
	public User getUserInfoByUserName(String userName) {
		return userDao.getUserInfoByUserName(userName);
	}
	
	public boolean checkDupUser(String userName) {
		User user = getUserInfoByUserName(userName);
		if (user != null) {
			return true;
		}
		
		return false;
	}

	public void setUserinfo(User user) {
		userDao.setUserInfo(user);
	}

}
